import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/font/iconfont.css'
import axios from 'axios'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

//设置访问根路径
axios.defaults.baseURL = "http://localhost:9000/example-web/"//正式部署之前要记得将这句话删掉。
//设置请求拦截器
axios.interceptors.request.use(config => {
	//发送请求就开启进度条
	NProgress.start()
	//塞入token
	config.headers.Authorization=window.sessionStorage.getItem('token');
	return config
})
//设置响应拦截器
axios.interceptors.response.use(config =>{
	//得到响应就隐藏进度条
	NProgress.done()
	return config
})

//挂载axios
Vue.prototype.$http = axios

new Vue({
	router,
	render: h => h(App)
}).$mount('#app')
